package  
{
	import org.flixel.plugin.photonstorm.FlxExtendedSprite;
	import org.flixel.FlxG;
	/**
	 * ...
	 * @author Lachlan McInnes
	 */
	public class Tile extends FlxExtendedSprite
	{
		public var isWall:Boolean;
		
		public function Tile(X:uint, Y:uint, SimpleGraphic:Class = null) 
		{
			super(X, Y, SimpleGraphic);
			
			isWall = false;
			color = Color.GreyWOA;
			immovable = true;
		}
		
		override public function update():void 
		{
			super.update();
			
			if (!isWall)
			{
				if (FlxG.mouse.pressed())
				{
					if ((FlxG.mouse.x >= x && FlxG.mouse.x <= x + width) && (FlxG.mouse.y >= y && FlxG.mouse.y <= y + height))
					{
						IsWallToggle();
					}
				}
			}
		}
		
		private function IsWallToggle():void
		{
			isWall = true;
			
			color = Color.RedWOA;
			
			Tilemap.wallGroup.add(this);
		}
		
	}

}